<?php
/**
 * Created by PhpStorm.
 * User: wzy12
 * Date: 2018/9/26
 * Time: 18:06
 */

namespace app\admin\validate;

use think\Validate;

class Goods extends Validate
{
    protected $rule = [
        'id'  =>  'require|number',
        'sort|排序'  =>  'require|number',
        'is_on_sale|值' => 'require|number',
        '__token__' => 'token|require',
        'goods_name|商品名称' => 'require',
        'goods_sn|商品货号' => 'require',
        'cate_id' => 'require',
        'shop_price|商品售价' => 'require',
        'market_price|市场价' => 'require',
        'cost_price|成本价' => 'require',
        'original_img|商品主图' => 'require',
        'weight|商品重量' => 'require|number',
        'volume|商品体积' => 'require|number',
        'is_free_shipping' => 'require|number',
        'store_count|总库存' => 'require|number',
        'details|商品详情描述' => 'require',
    ];

    protected $message = [
        '__token__.require'  =>  '请不要进行非法操作',
        'cate_id.require' => '请选择具体分类',
        'is_free_shipping.require' => '请不要进行非法操作',
        'is_free_shipping.number' => '请不要进行非法操作',
        'original_img.require' => '请上传商品主图'
    ];

    protected $scene = [
        'sort'  =>  ['__token__', 'id', 'sort'],
        'status' => ['id'],
        'del' => ['__token__'],
        'form' => ['__token__', 'original_img', 'goods_name', 'goods_sn', 'cate_id', 'shop_price', 'market_price', 'cost_price', 'weight', 'volume', 'is_free_shipping', 'store_count', 'details'],
    ];
}